Skip to content

Conversation

@KKennedyCodes
Copy link

Binary and Decimal

Congratulations! You're submitting your assignment.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

binary_to_decimal works well and you hit the major learning goals here. Check out my feedback on decimal_to_binary, and let me know if I can answer any questions.

def binary_to_decimal(binary_array)
raise NotImplementedError
array = binary_array
power = 7

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: I suggest making 7 a constant or using binary_array.length -1 just to make things more flexible and avoid hardcoding randomish numbers.

#raise NotImplementedError
end

def decimal_to_binary(decimal_number)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually reversing the binary digits, and your tests use numbers that read the same way backwards and forwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants